﻿using Qiniu.RS;
using System.Web.Mvc;

namespace IMT.Controllers
{
    public class QINIUController : Controller
    {
        //
        // GET: /QINIU/

        public ActionResult GetUploadToken()
        {
            Qiniu.Conf.Config.ACCESS_KEY = "y6viBZV17kbJaciO9PHV30lXETZn36FXCOInPS99";
            Qiniu.Conf.Config.SECRET_KEY = "aTgq6S0BLapW_YrEiS3L1fSA3VxRqoEWJvF-R9sy";
            //覆盖上传,<bucket>:<key>，表示只允许用户上传指定key的文件。在这种格式下文件默认允许“修改”，已存在同名资源则会被本次覆盖。
            PutPolicy put = new PutPolicy("cj-imt", 3600);
            ViewBag.token = put.Token();
            return Json(new { uptoken = put.Token() }, JsonRequestBehavior.AllowGet);
        }

    }
}
